package com.wudl.queue.service.impl;

import com.wudl.queue.config.ApplicationQueue;
import com.wudl.queue.domain.User;
import com.wudl.queue.mapper.UserMapper;
import com.wudl.queue.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：wudl
 * @date ：Created in 2021-12-12 22:12
 * @description：
 * @modified By：
 * @version: 1.0
 */

@Service
public class UserServiceImpl implements UserService {


    @Autowired
    UserMapper userMapper;

//    @Override
//    public void sendQueue(User user) throws Exception {
//        MailQueue.getMailQueue().produce(user);
//
//    }

    @Override
    public List<User> findAll() {
        return userMapper.findAll();
    }

    @Override
    public void addUser(User user) {
        userMapper.addUser(user);
    }

    @Override
    public void insertBatch(List<User> list) {

        userMapper.insertBatch(list);
    }

    @Override
    public void insertBatchTow(User list) throws InterruptedException {

        ApplicationQueue.getMailQueue().produce(list);
//        userMapper.insertBatch(list);
    }


}
